home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / pascal / totsrc11.zip / TOTIO1.PAS < prev    next >
Pascal/Delphi Source File  |  1993-05-24  |  65KB  |  2,355 lines

  1. {               Copyright 1991 TechnoJock Software, Inc.               }
  2. {                          All Rights Reserved                         }
  3. {                         Restricted by License                        }
  4.  
  5. {                             Build # 1.10b                            }
  6.  
  7. Unit totIO1;
  8. {$I TOTFLAGS.INC}
  9.  
  10. {
  11.  Development Notes:
  12.         1.00a  3/25/91   Checked for Active Status on HotKeys and
  13.                          allowed for no active fields in form.
  14.         1.00b  3/29/91   Changed HotSpotItemPtr in FormOBJ
  15.         1.00c  5/23/91   Added reaction to Mouse method 1
  16.         1.00d  5/29/91   Removed double leave hook calls
  17.         1.00e  6/01/91   Corrected Label FreeMem in VisibileIOOBJ
  18.         1.00f  6/11/91   Corrected Group label FreeMem
  19.         1.00g  6/11/91   Changed test for Bypassing in FormOBJ
  20.         1.00h  7/02/91   Added StayPut ID for Leave Field Hooks
  21.         1.00i  7/23/91   Change Radio Button to change selected item
  22.                          when presses Up or Down cursor.
  23.         1.00j  9/03/91   Added StopID to FormOBJ to determine
  24.                          which field ended input.
  25.         1.00k  9/03/91   Check active field for hotkey first - before
  26.                          jumping to first field.
  27.         1.00l  9/03/91   Changed colors for inactive Radio and Check groups.
  28.         1.00m  9/03/91   Absorbed mouse press on field selection
  29.         1.00n  9/09/91   Changed leave field hook refresh proc
  30.         1.00o 10/03/91   Refeshed field when StayPut
  31.         1.00p  9/03/92   Checked for active status on group object hotkeys
  32.         1.10a 05/03/93   Add label update in leave field hook
  33.                          & wait for mouse release before getting next input
  34.         1.10b 05/24/93   Ignored hotkeys with value of zero
  35. }
  36.  
  37. INTERFACE
  38.  
  39. uses DOS, CRT,
  40.      totSYS, totLOOK, totFAST, totWIN, totSTR, totINPUT;
  41.  
  42. CONST
  43.    NoRules      = $00;
  44.    AllowNull    = $01;
  45.    SuppressZero = $02;
  46.    EraseDefault = $08;
  47.    JumpIfFull   = $10;
  48.    MaxButtonWidth = 25;  {alter as necessary}
  49.    HelpID = 65535;
  50.    StayPut = 65534;  {1.00h}
  51. TYPE
  52.  
  53. tCursPos = (CursLeft,CursRight,CursPrev);
  54. tStatus = (HiStatus, Norm, Off);
  55. tAction = (None,NextField,PrevField,Finished,Escaped,
  56.            Refresh,Signal,Enter,Help,Stop1,Stop2,Stop3,Stop4,
  57.            Stop5,Stop6,Stop7,Stop8,Stop9);
  58. tColor = array[1..4] of byte;
  59.  
  60. StringBut = string[MaxButtonWidth];
  61.  
  62. LeaveFieldfunc = function(var FieldID:word): tAction;
  63. EnterFieldfunc = function(var NewID:word; OldID:word): tAction;
  64. CharFunc =       function(var K:word;var X,Y:byte; var FieldID:word): tAction;
  65. HelpProc =       procedure(ID:word);
  66.  
  67. tSignal = record
  68.    ID: word;
  69.    MsgType: word;
  70.    case word of           {variant record}
  71.    0: (MsgPtr: pointer);
  72.    1: (MsgLong: longint);
  73.    2: (MsgWord: word);
  74.    3: (MsgInt: integer);
  75.    4: (MsgByte: byte);
  76.    5: (MsgChar: char);
  77. end;
  78.  
  79. InputOBJ = object  {defines the default attributes for the fields}
  80.    vLabel: tColor;
  81.    vButton: tColor;
  82.    vGroup: tColor;
  83.    vList: tColor;
  84.    vField: tColor;  {Off, On, Mask, Inactive}
  85.    vMessage: byte;
  86.    vInputPad: char;
  87.    vCase: tCase;
  88.    vForceCase: boolean;     {adjust case of characters during input}
  89.    vInputJust: tJust;
  90.    vCursorLoc: tCursPos;
  91.    vInsert: boolean;      {is field initially in insert mode}
  92.    vRules: byte;          {erasedefault, jumpiffull..... etc.}
  93.    {methods...}
  94.    constructor Init;
  95.    procedure   SetDefaults;
  96.    procedure   SetColLabel(Off,OffHot,On,OnHot: byte);
  97.    procedure   SetColButton(Off,OffHot,On,OnHot: byte);
  98.    procedure   SetColGroup(Off,OffHot,On,OnHot: byte);
  99.    procedure   SetColList(Off,OffHot,On,OnHot: byte);
  100.    procedure   SetColField(Off,On,Mask,Inactive: byte);
  101.    procedure   SetColMsg(Col:byte);
  102.    procedure   SetIns(InsOn:boolean);
  103.    procedure   SetRules(Rules:byte);
  104.    procedure   SetPadChar(Pad:char);
  105.    procedure   SetJust(Just:tJust);
  106.    procedure   SetCursor(Curs: tCursPos);
  107.    procedure   SetCase(Cas:tCase);
  108.    procedure   SetForceCase(On:boolean);
  109.    function    LabelCol(Element:byte): byte;
  110.    function    ButtonCol(Element:byte): byte;
  111.    function    GroupCol(Element:byte): byte;
  112.    function    ListCol(Element:byte): byte;
  113.    function    FieldCol(Element:byte): byte;
  114.    function    MessageCol: byte;
  115.    function    InputPad: char;
  116.    function    InputIns:boolean;
  117.    function    InputRules: byte;
  118.    function    InputPadChar: char;
  119.    function    InputJust: tJust;
  120.    function    InputCursorLoc: tCursPos;
  121.    function    InputCase: tCase;
  122.    function    InputForceCase: boolean;
  123.    destructor  Done;
  124. end; {InputOBJ}
  125.  
  126. pItemIOOBJ = ^ItemIOOBJ;
  127. ItemIOOBJ = object
  128.    vBoundary: tCoords;
  129.    vHotKey: word;
  130.    vID: word;
  131.    vActive: boolean;
  132.    {methods ...}
  133.    constructor Init;
  134.    procedure   SetActiveStatus(Selectable:boolean);
  135.    function    Active:boolean;
  136.    function    GetHotKey: word;
  137.    procedure   SetHotkey(HK:word);
  138.    function    GetID: word;
  139.    procedure   SetID(ID:word);
  140.    function    Ontarget(X,Y: byte): boolean;                           VIRTUAL;
  141.    function    Visible: boolean;                                       VIRTUAL;
  142.    procedure   RaiseSignal(var TheSig:tSignal);                        VIRTUAL;
  143.    procedure   HandleSignal(var BaseSig:tSignal; var NewSig:tSignal);  VIRTUAL;
  144.    procedure   ShutdownSignal(var BaseSig:tSignal);                    VIRTUAL;
  145.    function    IsHotkey(HK:word):boolean;                              VIRTUAL;
  146.    procedure   WriteLabel(Status:tStatus);                             VIRTUAL;
  147.    procedure   Display(Status:tStatus);                                VIRTUAL;
  148.    function    Select(K:word; X,Y:byte):tAction;                       VIRTUAL;
  149.    function    ProcessKey(InKey:word;X,Y:byte):tAction;                VIRTUAL;
  150.    function    Suspend:boolean;                                        VIRTUAL;
  151.    destructor  Done;                                                   VIRTUAL;
  152. end; {ItemIOOBJ}
  153.  
  154. pHotkeyIOOBJ = ^HotkeyIOOBJ;
  155. HotkeyIOOBJ = object (ItemIOOBJ)
  156.    vActionCode: tAction;
  157.    {methods ...}
  158.    constructor Init(HK:Word;Act:tAction);
  159.    function    IsHotkey(HK:word):boolean;                              VIRTUAL;
  160.    function    Select(K:word; X,Y:byte):tAction;                       VIRTUAL;
  161.    destructor  Done;                                                   VIRTUAL;
  162. end; {HotkeyIOOBJ}
  163.  
  164. pControlKeysIOOBJ = ^ControlKeysIOOBJ;
  165. ControlKeysIOOBJ = object (ItemIOOBJ)
  166.    vFinKey: word;
  167.    vNexkey: word;
  168.    vPreKey: word;
  169.    vEscKey: word;
  170.    {methods ...}
  171.    constructor Init;
  172.    procedure   SetKeys(Next,Prev,Fin,Esc:Word);
  173.    function    IsHotkey(HK:word):boolean;                              VIRTUAL;
  174.    function    Select(K:word; X,Y:byte):tAction;                       VIRTUAL;
  175.    destructor  Done;                                                   VIRTUAL;
  176. end; {ControlKeysIOOBJ}
  177.  
  178. pVisibleIOOBJ = ^VisibleIOOBJ;
  179. VisibleIOOBJ = object (ItemIOOBJ)
  180.   vLblPtr: pointer;
  181.   vMsgPtr: pointer;
  182.   vMsgX: byte;
  183.   vMsgY: byte;
  184.   {methods ...}
  185.   constructor Init;
  186.   procedure   SetLabel(Lbl:string);
  187.   procedure   SetMessage(X,Y:byte; Msg:string);
  188.   procedure   WriteMessage;
  189.   function    Ontarget(X,Y: byte): boolean;             VIRTUAL;
  190.   function    Visible: boolean;                         VIRTUAL;
  191.   procedure   WriteLabel(Status:tStatus);               VIRTUAL;
  192.   function    Suspend:boolean;                          VIRTUAL;
  193.   destructor  Done;                                     VIRTUAL;
  194. end; {VisibleIOOBJ}
  195.  
  196. pStripIOOBJ = ^StripIOOBJ;
  197. StripIOOBJ = object(VisibleIOOBJ)
  198.    vTitle: StringBut;
  199.    vActionCode: tAction;
  200.    {methods ...}
  201.    constructor Init(X1,Y1:byte;Tit:string;Act:tAction);
  202.    function    Ontarget(X,Y: byte): boolean;            VIRTUAL;
  203.    function    IsHotkey(HK:word):boolean;               VIRTUAL;
  204.    procedure   Display(Status:tStatus);                 VIRTUAL;
  205.    function    Select(K:word; X,Y:byte):tAction;        VIRTUAL;
  206.    function    ProcessKey(InKey:word;X,Y:byte):tAction; VIRTUAL;
  207.    destructor  Done;                                    VIRTUAL;
  208. end; {StripIOOBJ}
  209.  
  210. pStrip3dIOOBJ = ^Strip3dIOOBJ;
  211. Strip3dIOOBJ = object(StripIOOBJ)
  212.    {methods ...}
  213.    constructor Init(X1,Y1:byte;Tit:string;Act:tAction);
  214.    procedure   Display(Status:tStatus);                 VIRTUAL;
  215.    destructor  Done;                                    VIRTUAL;
  216. end; {Strip3dIOOBJ}
  217.  
  218. pButtonIOOBJ = ^ButtonIOOBJ;
  219. ButtonIOOBJ = object(StripIOOBJ)
  220.    {methods ...}
  221.    constructor Init(X1,Y1:byte;Tit:string;Act:tAction);
  222.    procedure   Display(Status:tStatus);                 VIRTUAL;
  223.    destructor  Done;                                    VIRTUAL;
  224. end; {ButtonIOOBJ}
  225.  
  226. pMultiLineIOOBJ = ^MultiLineIOOBJ;
  227. MultiLineIOOBJ = object (VisibleIOOBJ)
  228.    vBorder: tCoords;
  229.    vTitle: StrVisible;
  230.    vRows: byte;
  231.    {methods ...}
  232.    constructor Init(X1,Y1,width,depth:byte;Title:string);
  233.    procedure   SetBoxOn(On:boolean);
  234.    procedure   Display(Status:tStatus);                  VIRTUAL;
  235.    procedure   Activate;                                 VIRTUAL;
  236.    destructor  Done;                                     VIRTUAL;
  237. end; {MultiLineIOOBJ}
  238.  
  239. GroupItemPtr = ^GroupItem;
  240. GroupItem = record
  241.    NextNode: GroupItemPtr;
  242.    PrevNode: GroupItemPtr;
  243.    StrPtr: Pointer;
  244.    HK: word;
  245.    Selected: boolean;
  246. end;
  247.  
  248. pGroupIOOBJ = ^GroupIOOBJ;
  249. GroupIOOBJ = object (MultiLineIOOBJ)
  250.    vItemStack: GroupItemPtr;
  251.    vTotalItems: byte;
  252.    vActiveItem: byte;
  253.    vOnStr: string[3];
  254.    vOffStr: string[3];
  255.    vSubHotkeysActive : boolean;
  256.    {methods ...}
  257.    constructor Init(X1,Y1,width,depth:byte;Title:string);
  258.    procedure   SetSubHotkeysActive(On:boolean);
  259.    function    EndNode: GroupItemPtr;
  260.    function    NodePtr(Item:byte): GroupItemPtr;
  261.    procedure   AddItem(Str:string;HK:word;Selected:boolean);
  262.    function    HotKeyItem(HK:word): integer;
  263.    function    HitItem(X,Y:byte):byte;
  264.    procedure   WriteItem(Item:byte; IsActive:boolean);
  265.    function    Select(K:word; X,Y:byte):tAction;                     VIRTUAL;
  266.    function    IsHotkey(HK:word):boolean;                            VIRTUAL;
  267.    procedure   Display(Status:tStatus);                              VIRTUAL;
  268.    destructor  Done;                                                 VIRTUAL;
  269. end;  {GroupIOOBJ}
  270.  
  271. pCheckIOOBJ = ^CheckIOOBJ;
  272. CheckIOOBJ = object (GroupIOOBJ)
  273.    {methods ...}
  274.    constructor Init(X1,Y1,width,depth:byte;Title:string);
  275.    procedure   SetValue(Item:byte;Selected:boolean);
  276.    function    GetValue(Item:byte):boolean;
  277.    function    ProcessKey(InKey:word;X,Y:byte):tAction;              VIRTUAL;
  278.    function    Select(K:word; X,Y:byte):tAction;                     VIRTUAL;
  279.    destructor  Done;                                                 VIRTUAL;
  280. end; {CheckIOOBJ}
  281.  
  282. pRadioIOOBJ = ^RadioIOOBJ;
  283. RadioIOOBJ = object (GroupIOOBJ)
  284.    {methods ...}
  285.    constructor Init(X1,Y1,width,depth:byte;Title:string);
  286.    procedure   SetValue(Item:byte);
  287.    function    GetValue: byte;
  288.    function    ProcessKey(InKey:word;X,Y:byte):tAction;              VIRTUAL;
  289.    function    Select(K:word; X,Y:byte):tAction;                     VIRTUAL;
  290.    destructor  Done;                                                 VIRTUAL;
  291. end; {RadioIOOBJ}
  292.  
  293. pItemNode = ^ItemNode;
  294. ItemNode = record
  295.    Item: pItemIOOBJ;
  296.    NextNode: pItemNode;
  297.    PrevNode: pItemNode;
  298. end; {ItemList}
  299.  
  300. pFormOBJ = ^FormOBJ;
  301. FormOBJ = object
  302.    vItemStack: pItemNode;
  303.    vActiveItem: pItemNode;
  304.    vCharHook: CharFunc;
  305.    vLeaveHook: LeaveFieldFunc;
  306.    vEnterHook: EnterFieldFunc;
  307.    vHelpHook:  HelpProc;
  308.    {methods ...}
  309.    constructor Init;
  310.    procedure   AddItem(var NewItem: ItemIOOBJ);
  311.    procedure   SetCharHook(Func:CharFunc);
  312.    procedure   SetLeaveHook(Func:LeaveFieldFunc);
  313.    procedure   SetEnterHook(Func:EnterFieldFunc);
  314.    procedure   SetHelpHook(Proc:HelpProc);
  315.    function    EndNode: pItemNode;
  316.    procedure   SetActiveItem(ID:word);
  317.    function    HotKeyItemPtr(HotKey:word):pItemNode;
  318.    function    IDItemPtr(ID:word):pItemNode;
  319.    function    HotSpotItemPtr(X,Y:byte):pItemNode;
  320.    function    Go: tAction;
  321.    procedure   BroadcastSignal(TheSig:tSignal; SignalSource: pItemNode);
  322.    procedure   DisplayItems;
  323.    function    StopID:word;
  324.    procedure   AdjustKey(var Key:word;var X,Y: byte);          VIRTUAL;
  325.    procedure   HelpTask(ID:word);                              VIRTUAL;
  326.    function    CharTask(var K:word;var X,Y:byte;
  327.                         var FieldID:word):tAction;             VIRTUAL;
  328.    function    EnterTask(var NewID:word; OldID:word): tAction; VIRTUAL;
  329.    function    LeaveTask(var FieldID:word): tAction;           VIRTUAL;
  330.    destructor  Done;                                           VIRTUAL;
  331. end; {FormOBJ}
  332.  
  333. WinFormPtr = ^WinFormOBJ;
  334. pWinFormOBJ = WinFormPtr;
  335. WinFormOBJ = object (FormOBJ)
  336.    vWinPtr: MoveWinPtr;
  337.    {methods ...}
  338.    constructor Init;
  339.    function    Win: MoveWinPtr;
  340.    procedure   Draw;
  341.    procedure   AdjustKey(var Key:word;var X,Y: byte);       VIRTUAL;
  342.    destructor  Done;                                        VIRTUAL;
  343. end; {WinFormOBJ}
  344.  
  345. procedure IO1Init;
  346. function NoCharHook(var K:word;var X,Y:byte;var FieldID:word): tAction;
  347. function NoEnterHook(var FieldID:word; OtherID:word): tAction;
  348. function NoLeaveHook(var ID:word): tAction;
  349. procedure NoHelpHook(ID:word);
  350. procedure AssignColors(Main,Inactive:tColor; Status:tStatus; var High,Nor:byte);
  351.  
  352. var
  353.   IOTOT: ^InputOBJ;
  354.  
  355. IMPLEMENTATION
  356. Var
  357.    FormHelpCalled,
  358.    EscapingForm: boolean;
  359. {|||||||||||||||||||||||||||||||||||||||||||||}
  360. {                                             }
  361. {     M i s c.  P r o c s   &   F u n c s     }
  362. {                                             }
  363. {|||||||||||||||||||||||||||||||||||||||||||||}
  364. {$F+}
  365. function NoCharHook(var K:word;var X,Y:byte;var FieldID:word): tAction;
  366. {}
  367. begin
  368.    NoCharHook := None;
  369. end; {NoCharHook}
  370.  
  371. function NoEnterHook(var FieldID:word; OtherID:word): tAction;
  372. {}
  373. begin
  374.    NoEnterHook := none;
  375. end; {NoEnterHook}
  376.  
  377. function NoLeaveHook(var ID:word): tAction;
  378. {}
  379. begin
  380.    NoLeaveHook := none;
  381. end; {NoLeaveHook}
  382.  
  383. procedure NoHelpHook(ID:word);
  384. {}
  385. begin
  386.    Ding;
  387. end; {NoHelpHook}
  388. {$IFNDEF OVERLAY}
  389.    {$F-}
  390. {$ENDIF}
  391.  
  392. procedure AssignColors(Main,Inactive:tColor; Status:tStatus; var High,Nor:byte);
  393. {}
  394. begin
  395.    Case Status of
  396.       HiStatus: begin
  397.          High := Main[4];
  398.          Nor := Main[3];
  399.       end;
  400.       Norm: begin
  401.          High := Main[2];
  402.          Nor := Main[1];
  403.       end;
  404.       Off: begin
  405.          High := Inactive[4];
  406.          Nor := Inactive[4];
  407.       end;
  408.    end; {case}
  409. end; {AssignColors}
  410. {|||||||||||||||||||||||||||||||||||||||||}
  411. {                                         }
  412. {     I n p u t O B J   M E T H O D S     }
  413. {                                         }
  414. {|||||||||||||||||||||||||||||||||||||||||}
  415. constructor InputOBJ.Init;
  416. {}
  417. begin
  418.    SetDefaults;
  419. end; {InputlOBJ.Init}
  420.  
  421. procedure InputOBJ.SetDefaults;
  422. {}
  423. begin
  424.    if Monitor^.ColorOn then {color System}
  425.    begin
  426.       SetColLabel(78,76,79,76);
  427.       SetColButton(32,46,47,46);
  428.       SetColGroup(48,62,63,62);
  429.       SetColList(48,62,31,30);
  430.       SetColField(48,31,23,71);
  431.    end
  432.    else
  433.    begin
  434.       SetColLabel(7,15,15,15);
  435.       SetColButton(7,15,15,15);
  436.       SetColGroup(7,15,15,15);
  437.       SetColList(7,15,15,15);
  438.       SetColField(7,15,15,15);
  439.    end;
  440.    SetColMsg(0);
  441.    vInputPad := chr(250);
  442.    vCase := Leave;
  443.    vForceCase := false;
  444.    vInputJust :=  JustLeft;
  445.    vCursorLoc := CursPrev;
  446.    vInsert := false;
  447.    vRules :=  AllowNull;
  448. end; {InputOBJ.SetDefaults}
  449.  
  450. procedure InputOBJ.SetColLabel(Off,OffHot,On,OnHot: byte);
  451. {}
  452. begin
  453.    vLabel[1] := Off;
  454.    vLabel[2] := OffHot;
  455.    vLabel[3] := On;
  456.    vLabel[4] := OnHot;
  457. end; {InputOBJ.SetColLabel}
  458.  
  459. procedure InputOBJ.SetColButton(Off,OffHot,On,OnHot: byte);
  460. {}
  461. begin
  462.    vButton[1] := Off;
  463.    vButton[2] := OffHot;
  464.    vButton[3] := On;
  465.    vButton[4] := OnHot;
  466. end; {InputOBJ.SetColButton}
  467.  
  468. procedure InputOBJ.SetColGroup(Off,OffHot,On,OnHot: byte);
  469. {}
  470. begin
  471.    vGroup[1] := Off;
  472.    vGroup[2] := OffHot;
  473.    vGroup[3] := On;
  474.    vGroup[4] := OnHot;
  475. end; {InputOBJ.SetColGroup}
  476.  
  477. procedure InputOBJ.SetColList(Off,OffHot,On,OnHot: byte);
  478. {}
  479. begin
  480.    vList[1] := Off;
  481.    vList[2] := OffHot;
  482.    vList[3] := On;
  483.    vList[4] := OnHot;
  484. end; {InputOBJ.SetColList}
  485.  
  486. procedure InputOBJ.SetColField(Off,On,Mask,Inactive: byte);
  487. {}
  488. begin
  489.    vField[1] := Off;
  490.    vField[2] := On;
  491.    vField[3] := Mask;
  492.    vField[4] := InActive;
  493. end; {InputOBJ.SetColField}
  494.  
  495. procedure InputOBJ.SetColMsg(Col:byte);
  496. {}
  497. begin
  498.    vMessage := Col;
  499. end; {InputOBJ.SetColMsg}
  500.  
  501. function InputOBJ.LabelCol(Element:byte): byte;
  502. {}
  503. begin
  504.    LabelCol := vLabel[Element];
  505. end; {InputOBJ.LabelCol}
  506.  
  507. function InputOBJ.ButtonCol(Element:byte): byte;
  508. {}
  509. begin
  510.    ButtonCol := vButton[Element];
  511. end; {InputOBJ.ButtonCol}
  512.  
  513. function InputOBJ.GroupCol(Element:byte): byte;
  514. {}
  515. begin
  516.    GroupCol := vGroup[Element];
  517. end; {InputOBJ.GroupCol}
  518.  
  519. function InputOBJ.ListCol(Element:byte): byte;
  520. {}
  521. begin
  522.    ListCol := vList[Element];
  523. end; {InputOBJ.ListCol}
  524.  
  525. function InputOBJ.FieldCol(Element:byte): byte;
  526. {}
  527. begin
  528.    FieldCol := vField[Element];
  529. end; {InputOBJ.FieldCol}
  530.  
  531. function InputOBJ.MessageCol: byte;
  532. {}
  533. begin
  534.    MessageCol := vMessage;
  535. end; {InputOBJ.MessageCol}
  536.  
  537. procedure InputOBJ.SetIns(InsOn:boolean);
  538. {}
  539. begin
  540.    vInsert := InsOn;
  541. end; {InputOBJ.SetIns}
  542.  
  543. procedure InputOBJ.SetRules(Rules:byte);
  544. {}
  545. begin
  546.    vRules := Rules;
  547. end; {SetRules}
  548.  
  549. procedure InputOBJ.SetPadChar(Pad:char);
  550. {}
  551. begin
  552.    vInputPad := Pad;
  553. end; {InputOBJ.SetPadChar}
  554.  
  555. procedure InputOBJ.SetCursor(Curs:tCursPos);
  556. {}
  557. begin
  558.    vCursorLoc := Curs;
  559. end; {InputOBJ.SetCurs}
  560.  
  561. procedure InputOBJ.SetJust(Just:tJust);
  562. {}
  563. begin
  564.    vInputJust := Just;
  565. end; {InputOBJ.SetJust}
  566.  
  567. procedure InputOBJ.SetCase(Cas:tCase);
  568. {}
  569. begin
  570.    vCase := Cas;
  571. end; {InputOBJ.SetCase}
  572.  
  573. procedure InputOBJ.SetForceCase(On:boolean);
  574. {}
  575. begin
  576.    vForceCase := On;
  577. end; {InputOBJ.SetForceCase}
  578.  
  579. function InputOBJ.InputPad: char;
  580. {}
  581. begin
  582.    InputPad := vInputPad;
  583. end; {of func InputOBJ.InputPad}
  584.  
  585. function InputOBJ.InputIns:boolean;
  586. {}
  587. begin
  588.    InputIns := vInsert;
  589. end; {InputOBJ.InputIns}
  590.  
  591. function InputOBJ.InputRules:byte;
  592. {}
  593. begin
  594.    InputRules := vRules;
  595. end; {InputOBJ.InputRules}
  596.  
  597. function InputOBJ.InputPadChar:char;
  598. {}
  599. begin
  600.    InputPadChar := vInputPad;
  601. end; {InputOBJ.InputPadChar}
  602.  
  603. function InputOBJ.InputJust:tJust;
  604. {}
  605. begin
  606.    InputJust := vInputJust;
  607. end; {InputOBJ.InputJust}
  608.  
  609. function InputOBJ.InputCursorLoc:tCursPos;
  610. {}
  611. begin
  612.    InputCursorLoc := vCursorLoc;
  613. end; {InputOBJ.InputCursorLoc}
  614.  
  615. function InputOBJ.InputCase:tCase;
  616. {}
  617. begin
  618.    InputCase := vCase;
  619. end; {InputOBJ.InputCase}
  620.  
  621. function InputOBJ.InputForceCase:boolean;
  622. {}
  623. begin
  624.    InputForceCase := vForceCase;
  625. end; {InputOBJ.InputForceCase}
  626.  
  627. destructor InputOBJ.Done;
  628. begin end;
  629. {||||||||||||||||||||||||||||||||||||||}
  630. {                                      }
  631. {     I t e m O B J   M E T H O D S    }
  632. {                                      }
  633. {||||||||||||||||||||||||||||||||||||||}
  634. constructor ItemIOOBJ.Init;
  635. {}
  636. begin
  637.    vActive := false;
  638.    vHotKey := 0;
  639.    vID := 0;
  640.    vBoundary.X1 := 0;
  641.    vBoundary.Y1 := 0;
  642.    vBoundary.X2 := 0;
  643.    vBoundary.Y2 := 0;
  644. end; {cons ItemIOOBJ.Init}
  645.  
  646. procedure ItemIOOBJ.SetActiveStatus(Selectable:boolean);
  647. {}
  648. begin
  649.    vActive := Selectable;
  650. end; {ItemIOOBJ.SetActiveStatus}
  651.  
  652. procedure ItemIOOBJ.SetHotkey(HK:word);
  653. {}
  654. begin
  655.     vHotKey := HK;
  656. end; {ItemIOOBJ.SetHotkey}
  657.  
  658. function ItemIOOBJ.GetHotKey:word;
  659. {}
  660. begin
  661.    GetHotKey := vHotkey;
  662. end; {ItemIOOBJ.GetHotKey}
  663.  
  664. procedure ItemIOOBJ.SetID(ID:word);
  665. {}
  666. begin
  667.     vID := ID;
  668. end; {ItemIOOBJ.SetID}
  669.  
  670. function ItemIOOBJ.GetID:word;
  671. {}
  672. begin
  673.    GetID := vID;
  674. end; {ItemIOOBJ.GetID}
  675.  
  676. function ItemIOOBJ.Visible: boolean;
  677. {}
  678. begin
  679.    Visible := false;
  680. end; {ItemIOOBJ.Visible}
  681.  
  682. function ItemIOOBJ.Active:boolean;
  683. {}
  684. begin
  685.    Active := vActive;
  686. end; {ItemIOOBJ.Active}
  687.  
  688. function ItemIOOBJ.IsHotKey(HK:word):boolean;
  689. {}
  690. begin
  691.    IsHotKey := (HK = vHotKey) and vActive;   {1.00a}
  692. end; {ItemIOOBJ.IsHotKey}
  693.  
  694. function ItemIOOBJ.OnTarget(X,Y: byte):boolean;
  695. {}
  696. begin
  697.    Ontarget :=     (X >= vBoundary.X1)
  698.                and (X <= vBoundary.X2)
  699.                and (Y >= vBoundary.Y1)
  700.                and (Y <= vBoundary.Y2)
  701.                and vActive;
  702. end; {ItemIOOBJ.HotKey}
  703.  
  704. function ItemIOOBJ.Select(K:word; X,Y:byte):tAction;
  705. {}
  706. begin
  707.    Select := None;
  708. end;
  709.  
  710. function ItemIOOBJ.ProcessKey(InKey:word;X,Y:byte):tAction;
  711. {}
  712. begin
  713.    ProcessKey := None;
  714. end;
  715.  
  716. procedure ItemIOOBJ.WriteLabel(Status:tStatus);
  717. {}
  718. begin end;
  719.  
  720. procedure ItemIOOBJ.Display(Status:tStatus);
  721. {}
  722. begin end;
  723.  
  724. function ItemIOOBJ.Suspend;
  725. {}
  726. begin
  727.    Display(Norm);
  728.    Suspend := true;
  729. end; {ItemIOOBJ.Suspend}
  730.  
  731. procedure ItemIOOBJ.RaiseSignal(var TheSig:tSignal);
  732. {abstract}
  733. begin end;
  734.  
  735. procedure ItemIOOBJ.HandleSignal(var BaseSig:tSignal; var NewSig:tSignal);
  736. {abstract}
  737. begin end;
  738.  
  739. procedure ItemIOOBJ.ShutDownSignal(var BaseSig:tSignal);
  740. {abstract}
  741. begin end;
  742.  
  743. destructor ItemIOOBJ.Done;
  744. {}
  745. begin end;
  746.  
  747. {||||||||||||||||||||||||||||||||||||||||||}
  748. {                                          }
  749. {     H o t k e y O B J   M E T H O D S    }
  750. {                                          }
  751. {||||||||||||||||||||||||||||||||||||||||||}
  752.  
  753. constructor HotkeyIOOBJ.Init(HK:word; Act:tAction);
  754. {}
  755. begin
  756.    ItemIOOBJ.Init;
  757.    vBoundary.X1 := -128;
  758.    vBoundary.X2 := -128;
  759.    vBoundary.Y1 := -128;
  760.    vBoundary.Y2 := -128;
  761.    vActionCode := Act;
  762.    vHotKey := HK;
  763. end; {cons HotkeyIOOBJ.Init}
  764.  
  765. function HotkeyIOOBJ.Select(K:word; X,Y:byte):tAction;
  766. {}
  767. begin
  768.    Select := vActionCode;
  769. end; {HotkeyIOOBJ.Select}
  770.  
  771. function HotkeyIOOBJ.IsHotKey(HK:word):boolean;
  772. {}
  773. begin
  774.    if HK = vHotKey then
  775.    begin
  776.       EscapingForm := (vActionCode = Escaped);
  777.       FormHelpCalled := (vActionCode = Help);
  778.       IsHotkey := true
  779.    end
  780.    else
  781.      IsHotKey := false;
  782. end; {HotkeyIOOBJ.IsHotKey}
  783.  
  784. destructor HotkeyIOOBJ.Done;
  785. {}
  786. begin
  787.    ItemIOOBJ.Done;
  788. end; {dest HotkeyIOOBJ.Done}
  789. {||||||||||||||||||||||||||||||||||||||||||||||||||||||||}
  790. {                                                        }
  791. {     C o n t r o l K e y s I O O B J   M E T H O D S    }
  792. {                                                        }
  793. {||||||||||||||||||||||||||||||||||||||||||||||||||||||||}
  794. constructor ControlKeysIOOBJ.Init;
  795. {}
  796. begin
  797.    ItemIOOBJ.Init;
  798.    vFinKey:= 324;
  799.    vNexkey:= 9;
  800.    vPreKey:= 271;
  801.    vEscKey:= 27;
  802. end; {ControlKeysIOOBJ.Init}
  803.  
  804. procedure ControlKeysIOOBJ.SetKeys(Next,Prev,Fin,Esc:Word);
  805. {}
  806. begin
  807.    vFinKey:= Fin;
  808.    vNexkey:= Next;
  809.    vPreKey:= Prev;
  810.    vEscKey:= Esc;
  811. end; {ControlKeysIOOBJ.SetKeys}
  812.  
  813. function ControlKeysIOOBJ.IsHotkey(HK:word):boolean;
  814. {}
  815. begin
  816.    if (Hk=vEscKey) then
  817.       EscapingForm := true;
  818.    IsHotKey := (   (HK=vFinKey)
  819.                 or (HK=vNexKey)
  820.                 or (HK=vPreKey)
  821.                 or (Hk=vEscKey)
  822.                );
  823. end; {ControlKeysIOOBJ.IsHotkey}
  824.  
  825. function ControlKeysIOOBJ.Select(K:word; X,Y:byte):tAction;
  826. {}
  827. begin
  828.    if AlphabetTOT^.IsLower(K) then
  829.       K := ord(AlphabetTOT^.GetUpcase(chr(K)));
  830.    if (K = vFinKey) then
  831.       Select := Finished
  832.    else if (K = vNexkey) then
  833.       Select := NextField
  834.    else if (K = vPreKey) then
  835.       Select := PrevField
  836.    else if (K = vEscKey) then
  837.       Select := Escaped
  838.    else
  839.       Select := None;
  840. end; {ControlKeysIOOBJ.Select}
  841.  
  842. destructor ControlKeysIOOBJ.Done;                            
  843. {}
  844. begin
  845.    ItemIOOBJ.Done;
  846. end; {ControlKeysIOOBJ.Done}
  847. {||||||||||||||||||||||||||||||||||||||||||||||||||||||}
  848. {                                                      }
  849. {     V i s i b l e F i e l d O B J   M E T H O D S    }
  850. {                                                      }
  851. {||||||||||||||||||||||||||||||||||||||||||||||||||||||}
  852. constructor VisibleIOOBJ.Init;
  853. {}
  854. begin
  855.   ItemIOOBJ.Init;
  856.   vActive := true;
  857.   vLblPtr := nil;
  858.   vMsgPtr := nil;
  859. end; {VisibleIOOBJ.Init}
  860.  
  861. function VisibleIOOBJ.Visible: boolean;
  862. {}
  863. begin
  864.    Visible := true;
  865. end; {VisibleIOOBJ.Visible}
  866.  
  867. procedure VisibleIOOBJ.SetLabel(Lbl:string);
  868. {}
  869. var L : word;
  870. begin
  871.    L := succ(length(Lbl));
  872.    if MaxAvail >= L then
  873.    begin
  874.       getmem(vLblPtr,L);
  875.       move(Lbl[0],vLblPtr^,L);
  876.    end;
  877. end; {VisibleIOOBJ.SetLabel}
  878.  
  879. function VisibleIOOBJ.OnTarget(X,Y: byte):boolean;
  880. {}
  881. var LabelLen: byte;
  882. begin
  883.    if vLblPtr = nil then
  884.       LabelLen := 0
  885.    else
  886.    begin
  887.       move(vLblPtr^,LabelLen,1);
  888.       if LabelLen > 1 then
  889.          inc(LabelLen);
  890.    end;
  891.    OnTarget :=     (X >= vBoundary.X1 - LabelLen)
  892.                and (X <= vBoundary.X2)
  893.                and (Y >= vBoundary.Y1)
  894.                and (Y <= vBoundary.Y2)
  895.                and vActive;
  896. end; {VisibleIOOBJ.OnTarget}
  897.  
  898. procedure VisibleIOOBJ.SetMessage(X,Y:byte; Msg:string);
  899. {}
  900. var L : word;
  901. begin
  902.    L := succ(length(Msg));
  903.    if MaxAvail >= L then
  904.    begin
  905.       getmem(vMsgPtr,L);
  906.       move(Msg[0],vMsgPtr^,L);
  907.       vMsgX := X;
  908.       vMsgY := Y;
  909.    end;
  910. end; {VisibleIOOBJ.SetMessage}
  911.  
  912. procedure VisibleIOOBJ.WriteLabel(Status:tStatus);
  913. {}
  914. var
  915.   Temp: string;
  916.   Norm,Hi,L: byte;
  917. begin
  918.    if vLblPtr <> nil then
  919.    begin
  920.       move(vLblPtr^,L,1);
  921.       if L > 0 then
  922.       begin
  923.          move(vLblPtr^,Temp,succ(L));
  924.          AssignColors(IOTOT^.vLabel,IOTOT^.vField,Status,Hi,Norm);
  925.          if (Hi = 0) or (Norm = 0) then
  926.             Screen.WritePlain(pred(vBoundary.X1) - length(Temp),vBoundary.Y1,Temp)
  927.          else
  928.             Screen.WriteHi(pred(vBoundary.X1)-length(strip('A',Screen.Himarker,Temp)),vBoundary.Y1,Hi,Norm,Temp);
  929.       end;
  930.    end;
  931. end; {VisibleIOOBJ.WriteLabel}
  932.  
  933. procedure VisibleIOOBJ.WriteMessage;
  934. {}
  935. var
  936.   Temp: string;
  937.   Col,L: byte;
  938. begin
  939.    if vMsgPtr <> nil then
  940.    begin
  941.       move(vMsgPtr^,L,1);
  942.       if L > 0 then
  943.       begin
  944.          move(vMsgPtr^,Temp,succ(L));
  945.          Col := IOTOT^.MessageCol;
  946.          if Col = 0 then
  947.             Screen.WritePlain(vMsgX,vMsgY,Temp)
  948.          else
  949.             Screen.WriteAt(vMsgX,vMsgY,Col,Temp);
  950.       end;
  951.    end;
  952. end; {VisibleIOOBJ.WriteMessage}
  953.  
  954. function VisibleIOOBJ.Suspend:boolean;
  955. {}
  956. var Col,L: byte;
  957. begin
  958.    Display(Norm);
  959.    WriteLabel(Norm);
  960.    if vMsgPtr <> Nil then   {clear the message}
  961.    begin
  962.       move(vMsgPtr^,L,1);
  963.       if L > 0 then
  964.       begin
  965.          Col := IOTOT^.MessageCol;
  966.          if Col = 0 then
  967.             Screen.WritePlain(vMsgX,vMsgY,replicate(L,' '))
  968.          else
  969.             Screen.WriteAt(vMsgX,vMsgY,Col,replicate(L,' '));
  970.  
  971.       end;
  972.    end;
  973.    Suspend := true;
  974. end; {VisibleIOOBJ.Suspend}
  975.  
  976. destructor VisibleIOOBJ.Done;
  977. {}
  978. var Len : byte;
  979. begin
  980.    ItemIOOBJ.Done;
  981.    if vLblPtr <> Nil then
  982.    begin
  983.       Move(vLblPtr^,Len,1);
  984.       FreeMem(vLblPtr,succ(Len));    {1.00e}
  985.    end;
  986.    if vMsgPtr <> Nil then
  987.    begin
  988.       Move(vMsgPtr^,Len,1);
  989.       FreeMem(vMsgPtr,succ(Len));    {1.00e}
  990.    end;
  991. end; {desc VisibleIOOBJ.Done}
  992.  
  993. {||||||||||||||||||||||||||||||||||||||||}
  994. {                                        }
  995. {     S t r i p O B J   M E T H O D S    }
  996. {                                        }
  997. {||||||||||||||||||||||||||||||||||||||||}
  998.  
  999. constructor StripIOOBJ.Init(X1,Y1:byte;Tit:string;Act:tAction);
  1000. {}
  1001. begin
  1002.    VisibleIOOBJ.Init;
  1003.    vBoundary.X1 := X1;
  1004.    vBoundary.Y1 := Y1;
  1005.    vBoundary.X2 := X1 + pred(length(Strip('A','~',Tit)));
  1006.    vBoundary.Y2 := Y1;
  1007.    vTitle := Tit;
  1008.    vActionCode := Act;
  1009. end; {StripIOOBJ.Init}
  1010.  
  1011. function StripIOOBJ.IsHotKey(HK:word):boolean;
  1012. {}
  1013. begin
  1014.    IsHotKey := (HK = vHotKey) and (vActive);   {1.00a}
  1015.    if HK = vHotKey then
  1016.    begin
  1017.       EscapingForm := (vActionCode = Escaped);
  1018.       FormHelpCalled := (vActionCode = Help);
  1019.    end;
  1020. end; {StripIOOBJ.IsHotKey}
  1021.  
  1022. function StripIOOBJ.OnTarget(X,Y: byte):boolean;
  1023. {}
  1024. Var BullsEye: boolean;
  1025. begin
  1026.    BullsEye := VisibleIOOBJ.OnTarget(X,Y);
  1027.    if BullsEye then
  1028.    begin
  1029.       EscapingForm := (vActionCode = Escaped);
  1030.       FormHelpCalled := (vActionCode = Help);
  1031.    end;
  1032.    OnTarget := BullsEye;
  1033. end; {ItemIOOBJ.HotKey}
  1034.  
  1035. procedure StripIOOBJ.Display(Status:tStatus);
  1036. {}
  1037. var
  1038.    Nor,High: Byte;
  1039. begin
  1040.    AssignColors(IOTOT^.vButton,IOTOT^.vField,Status,High,Nor);
  1041.    with vBoundary do
  1042.    begin
  1043.       Screen.WriteHi(X1,Y1,High,Nor,vTitle);
  1044.       if Status = HiStatus then
  1045.          GotoXY(X1 + (X2-X1) div 2,Y1 + (Y2 - Y1) div 2);
  1046.    end;
  1047. end; {StripIOOBJ.Display}
  1048.  
  1049. function StripIOOBJ.Select(K:word; X,Y:byte):tAction;
  1050. {}
  1051. begin
  1052.    Display(HiStatus);
  1053.    WriteMessage;
  1054.    if AlphabetTOT^.IsLower(K) then
  1055.       K := ord(AlphabetTOT^.GetUpcase(chr(K)));
  1056.    if ((K <> 0) and (K = vHotKey)) or (K = 513) then
  1057.       Select := vActionCode
  1058.    else
  1059.       Select := none;
  1060. end; {StripIOOBJ.Select}
  1061.  
  1062. function StripIOOBJ.ProcessKey(InKey:word;X,Y:byte):tAction;
  1063. {}
  1064. begin
  1065.    if (InKey = 13) or (InKey = 513) then
  1066.       ProcessKey := vActionCode
  1067.    else
  1068.       Processkey := None;
  1069. end; {StripIOOBJ.ProcessKey}
  1070.  
  1071. destructor StripIOOBJ.Done;
  1072. {}
  1073. begin
  1074.    VisibleIOOBJ.Done;
  1075. end; {StripIOOBJ.Done}
  1076. {||||||||||||||||||||||||||||||||||||||||||||}
  1077. {                                            }
  1078. {     S t r i p 3 d O B J   M E T H O D S    }
  1079. {                                            }
  1080. {||||||||||||||||||||||||||||||||||||||||||||}
  1081. constructor Strip3dIOOBJ.Init(X1,Y1:byte;Tit:string;Act:tAction);
  1082. {}
  1083. begin
  1084.    StripIOOBJ.Init(X1,Y1,Tit,Act);
  1085. end; {Strip3dIOOBJ.Init}
  1086.  
  1087. procedure Strip3dIOOBJ.Display(Status:tStatus);
  1088. {}
  1089. var High,Nor,A: byte;
  1090. begin
  1091.    StripIOOBJ.Display(Status);
  1092.    A := Screen.ReadAttr(succ(vBoundary.X1),succ(vBoundary.Y1));
  1093.    if Monitor^.ColorOn then {color System}
  1094.       A := Cattr(black,battr(A))
  1095.    else
  1096.       A := Cattr(darkgray,battr(A));
  1097.    Screen.WriteAT(succ(vBoundary.X1),succ(vBoundary.Y1),A,
  1098.                   replicate(succ(vBoundary.X2-vBoundary.X1),char(223)));
  1099.    Screen.WriteAT(succ(vBoundary.X2),vBoundary.Y1,A,char(220));
  1100. end; {Strip3dIOOBJ.Display}
  1101.  
  1102. destructor Strip3dIOOBJ.Done;
  1103. {}
  1104. begin
  1105.    StripIOOBJ.Done;
  1106. end; {desc Strip3dIOOBJ.Done}
  1107.  
  1108. {||||||||||||||||||||||||||||||||||||||||||}
  1109. {                                          }
  1110. {     B u t t o n O B J   M E T H O D S    }
  1111. {                                          }
  1112. {||||||||||||||||||||||||||||||||||||||||||}
  1113.  
  1114. constructor ButtonIOOBJ.Init(X1,Y1:byte;Tit:string;Act:tAction);
  1115. {}
  1116. var L : byte;
  1117. begin
  1118.    StripIOOBJ.Init(X1,Y1,Tit,Act);
  1119.    L := length(Strip('A','~',Tit));
  1120.    vBoundary.X2 := succ(X1 + L);
  1121.    vBoundary.Y2 := Y1 + 2;
  1122. end; {ButtonIOOBJ.Init}
  1123.  
  1124. procedure ButtonIOOBJ.Display(Status:tStatus);
  1125. {}
  1126. var
  1127.    High,Nor,Style: Byte;
  1128. begin
  1129.    AssignColors(IOTOT^.vButton,IOTOT^.vField,Status,High,Nor);
  1130.    if Status = HiStatus then
  1131.       Style := 5
  1132.    else
  1133.       Style := 1;
  1134.    with vBoundary do
  1135.    begin
  1136.       Screen.FillBox(X1,Y1,X2,Y2,Nor,Style);
  1137.       Screen.WriteHi(succ(X1),succ(Y1),High,Nor,vTitle);
  1138.       if Status = HiStatus then
  1139.          GotoXY(X1 + (X2-X1) div 2,Y1 + (Y2 - Y1) div 2);
  1140.    end;
  1141. end; {ButtonIOOBJ.Display}
  1142.  
  1143. destructor ButtonIOOBJ.Done;
  1144. {}
  1145. begin
  1146.    StripIOOBJ.Done;
  1147. end; {desc ButtonIOOBJ.Done}
  1148.  
  1149. {||||||||||||||||||||||||||||||||||||||||||||||||}
  1150. {                                                }
  1151. {     M u l t i L i n e O B J   M E T H O D S    }
  1152. {                                                }
  1153. {||||||||||||||||||||||||||||||||||||||||||||||||}
  1154.  
  1155. constructor MultiLineIOOBJ.Init(X1,Y1,width,depth:byte;Title:string);
  1156. {}
  1157. begin
  1158.    VisibleIOOBJ.Init;
  1159.    vTitle:= Title;
  1160.    vBoundary.X1 := X1;
  1161.    vBoundary.Y1 := Y1;
  1162.    vBoundary.X2 := pred(X1+width);
  1163.    vBoundary.Y2 := pred(Y1+depth);
  1164.    SetBoxOn(False);
  1165. end; {MultiLineIOOBJ.Init}
  1166.  
  1167. procedure MultiLineIOOBJ.SetBoxOn(On:boolean);
  1168. {}
  1169. begin
  1170.    if On then
  1171.    begin
  1172.       vBorder.X1 := succ(vBoundary.X1);
  1173.       vBorder.X2 := pred(vBoundary.X2);
  1174.       if vTitle = '' then
  1175.          vBorder.Y1 := succ(vBoundary.Y1)
  1176.       else
  1177.          vBorder.Y1 := (vBoundary.Y1+2);
  1178.       vBorder.Y2 := pred(vBoundary.Y2);
  1179.    end
  1180.    else
  1181.    begin
  1182.       vBorder.X1 := vBoundary.X1;
  1183.       vBorder.X2 := vBoundary.X2;
  1184.       if vTitle = '' then
  1185.          vBorder.Y1 := vBoundary.Y1
  1186.       else
  1187.          vBorder.Y1 := succ(vBoundary.Y1);
  1188.       vBorder.Y2 := vBoundary.Y2;
  1189.    end;
  1190.    vRows := vBorder.Y2 - pred(vBorder.Y1);
  1191. end; {MultiLineIOOBJ.SetBoxOn}
  1192.  
  1193. procedure MultiLineIOOBJ.Display(Status:tStatus);
  1194. {}
  1195. var
  1196.   High,Nor: byte;
  1197.   Style: byte;
  1198.   I : integer;
  1199. begin
  1200.    AssignColors(IOTOT^.vLabel,IOTOT^.vField,Status,High,Nor);
  1201.    if Status = HiStatus then
  1202.       Style := 2
  1203.    else
  1204.       Style := 1;
  1205.    with Screen do
  1206.    begin
  1207.       if vTitle <> '' then
  1208.          WriteHi(vBoundary.X1,vBoundary.Y1,High,Nor,vTitle);
  1209.       if vBoundary.X1 < vBorder.X1 then  {box}
  1210.          with vBorder do
  1211.             Box(pred(X1),pred(Y1),succ(X2),succ(Y2),Nor,Style);
  1212.    end;
  1213. end; {MultiLineIOOBJ.Display}
  1214.  
  1215. procedure MultiLineIOOBJ.Activate;
  1216. {}
  1217. var
  1218.    Action: tAction;
  1219. begin
  1220.    repeat
  1221.       Action := Select(0,0,0);
  1222.       Display(HiStatus);
  1223.       WriteLabel(HiStatus);
  1224.       with Key do 
  1225.       repeat
  1226.          GetInput;
  1227.          if LastKey = 27 then
  1228.             Action := Escaped
  1229.          else
  1230.             Action := ProcessKey(LastKey,LastX,LastY);
  1231.       until Action in [Finished,Escaped,Enter,NextField,PrevField,Stop1..Stop9];
  1232.    until Suspend;
  1233. end; {MultiLineIOOBJ.Activate}
  1234.  
  1235. destructor MultiLineIOOBJ.Done;
  1236. {}
  1237. begin
  1238.    VisibleIOOBJ.Done;
  1239. end; {MultiLineIOOBJ.Done}
  1240. {||||||||||||||||||||||||||||||||||||||||}
  1241. {                                        }
  1242. {     G r o u p O B J   M E T H O D S    }
  1243. {                                        }
  1244. {||||||||||||||||||||||||||||||||||||||||}
  1245. constructor GroupIOOBJ.Init(X1,Y1,width,depth:byte;Title:string);
  1246. {}
  1247. begin
  1248.    MultiLineIOOBJ.Init(X1,Y1,width,depth,Title);
  1249.    vItemStack := nil;
  1250.    vActiveItem := 0;
  1251.    vTotalItems := 0;
  1252.    vSubHotkeysActive := false;
  1253. end; {GroupIOOBJ.Init}
  1254.  
  1255. procedure GroupIOOBJ.SetSubHotkeysActive(On:boolean);
  1256. {}
  1257. begin
  1258.    vSubHotkeysActive := On;
  1259. end; {GroupIOOBJ.SetSubHotkeysActive}
  1260.  
  1261. procedure GroupIOOBJ.WriteItem(Item:byte; IsActive:boolean);
  1262. {}
  1263. var
  1264.   Temp: GroupItemPtr;
  1265.   High,Nor:byte;
  1266.   Status: tStatus;
  1267.   Len : byte;
  1268.   Str : string;
  1269. begin
  1270.    if IsActive then          {1.00l}
  1271.       Status := HiStatus
  1272.    else if vActive then
  1273.       Status := Norm
  1274.    else
  1275.       Status := Off;
  1276.    AssignColors(IOTOT^.vGroup,IOTOT^.vField,Status,High,Nor);
  1277.    Temp := NodePtr(Item);
  1278.    if (Temp = nil) or (Temp^.StrPtr = nil) then
  1279.       exit
  1280.    else
  1281.    begin
  1282.       move(Temp^.StrPtr^,Len,1);
  1283.       if Len > 0 then
  1284.          move(Temp^.StrPtr^,Str,succ(Len))
  1285.       else
  1286.          Str := '';
  1287.       if Temp^.Selected then
  1288.          Str := vOnStr+' '+Str
  1289.       else
  1290.          Str := vOffStr+' '+Str;
  1291.       Str := Padleft(Str,vBorder.X2 
  1292.                         - pred(vBorder.X1)
  1293.                         + length(Str) 
  1294.                         - length(strip('A',Screen.HiMarker,Str)),
  1295.                         ' ');
  1296.       Screen.WriteHi(vBorder.X1,vBorder.Y1+pred(Item),High,Nor,Str);
  1297.       if IsActive then
  1298.          Screen.GotoXY(succ(vBorder.X1),vBorder.Y1+pred(Item));
  1299.    end;
  1300. end; {GroupIOOBJ.WriteItem}
  1301.  
  1302. procedure GroupIOOBJ.Display(Status:tStatus);
  1303. {}
  1304. var
  1305.   BorderCol : byte;
  1306.   Style: byte;
  1307.   I : integer;
  1308. begin
  1309.    MultiLineIOOBJ.Display(Status);
  1310.    for I := 1 to vTotalItems do
  1311.       WriteItem(I,((I=vActiveItem) and (Status=HiStatus)));
  1312. end; {GroupIOOBJ.Display}
  1313.  
  1314. function GroupIOOBJ.Select(K:word; X,Y:byte):tAction;
  1315. {}
  1316. begin
  1317.    Display(HiStatus);
  1318.    Select := none;
  1319. end; {StripIOOBJ.Select}
  1320.  
  1321. function GroupIOOBJ.HotKeyItem(HK:word): integer;
  1322. {}
  1323. var 
  1324.    Counter:integer;
  1325.    Temp: GroupItemPtr;
  1326.    Found : boolean;
  1327. begin
  1328.    if vSubHotkeysActive then
  1329.    begin
  1330.       if AlphabetTOT^.IsLower(HK) then
  1331.          HK := ord(AlphabetTOT^.GetUpcase(chr(HK)));
  1332.       Found := false;
  1333.       Counter := 1;
  1334.       Temp := vItemStack;
  1335.       while (Temp <> nil) and (Found = false) do
  1336.       begin
  1337.          Found := (Temp^.HK = HK);
  1338.          if not Found then
  1339.          begin
  1340.             inc(Counter);
  1341.             Temp := Temp^.NextNode;
  1342.          end;
  1343.       end;
  1344.       if Found then
  1345.          HotKeyItem := Counter
  1346.       else
  1347.          HotKeyItem := 0;
  1348.    end
  1349.    else
  1350.      HotkeyItem := 0;
  1351. end; {GroupIOOBJ.HotKeyItem}
  1352.  
  1353. function GroupIOOBJ.IsHotkey(HK:word):boolean;
  1354. {}
  1355. var
  1356.   Found : boolean;
  1357.   Temp: GroupItemPtr;
  1358. begin
  1359.    Found := (HK = vHotkey) and vActive;   {1.00p}
  1360.    if (Found = false) and vActive then    {1.00p}
  1361.       Found := (HotKeyItem(HK) > 0);
  1362.    IsHotkey := found;   
  1363. end;  {GroupIOOBJ.IsHotkey}
  1364.  
  1365. function GroupIOOBJ.EndNode: GroupItemPtr;
  1366. {returns a pointer to the last item in the list}
  1367. var
  1368.    Temp : GroupItemPtr;
  1369. begin
  1370.    Temp := vItemStack;
  1371.    while (Temp <> nil) and (Temp^.NextNode <> nil) do
  1372.       Temp := Temp^.NextNode;
  1373.    EndNode := Temp;
  1374. end; {GroupIOOBJ.EndNode}
  1375.  
  1376. procedure GroupIOOBJ.AddItem(Str:string;HK:word;Selected:boolean);
  1377. {}
  1378. var Temp: GroupItemPtr;
  1379. begin
  1380.    if MaxAvail < SizeOf(vItemStack^) + succ(Length(Str)) then
  1381.       exit
  1382.    else
  1383.    begin
  1384.       if vItemStack = Nil then
  1385.       begin
  1386.          getmem(vItemStack,sizeof(vItemStack^));
  1387.          vActiveItem := 1;
  1388.          vItemStack^.PrevNode := Nil;
  1389.          Temp := vItemStack;
  1390.       end
  1391.       else
  1392.       begin
  1393.          Temp := EndNode;
  1394.          getmem(Temp^.NextNode, sizeof(Temp^));
  1395.          Temp^.NextNode^.PrevNode := Temp;
  1396.          Temp := Temp^.NextNode;
  1397.       end;
  1398.       Temp^.NextNode := nil;
  1399.       inc(vTotalItems);
  1400.       getmem(Temp^.StrPtr,succ(length(Str)));
  1401.       move(Str[0],Temp^.StrPtr^,succ(length(Str)));
  1402.       Temp^.HK := HK;
  1403.       Temp^.Selected := Selected;
  1404.       if HK <> 0 then
  1405.          vSubHotKeysActive := true;
  1406.    end;
  1407. end; {GroupIOOBJ.AddItem}
  1408.  
  1409. function GroupIOOBJ.HitItem(X,Y:byte):byte;
  1410. {returns the item number of the item falling on line Y, else returns 0}
  1411. var
  1412.   B: integer;
  1413. begin
  1414.     B := Y - pred(vBorder.Y1);
  1415.     if (B > vTotalItems) or (B < 0) or (X < vBorder.X1) or (X> vBorder.X2) then
  1416.        HitItem := 0
  1417.     else
  1418.        HitItem := B;
  1419. end; {GroupIOOBJ.HitItem}
  1420.  
  1421. function GroupIOOBJ.NodePtr(Item:byte): GroupItemPtr;
  1422. {}
  1423. var
  1424.   Temp: GroupItemPtr;
  1425.   I: integer;
  1426. begin
  1427.    Temp := vItemStack;
  1428.    if Item > 1 then
  1429.       for I := 2 to Item do
  1430.          if Temp <> Nil then
  1431.             Temp := Temp^.NextNode;
  1432.    NodePtr := Temp;
  1433. end; {GroupIOOBJ.NodePtr}
  1434.  
  1435. destructor GroupIOOBJ.Done;
  1436. {}
  1437. var 
  1438.   Temp: GroupItemPtr;
  1439.   Len: byte;
  1440. begin
  1441.    MultiLineIOOBJ.Done;
  1442.    Temp := EndNode;
  1443.    while Temp <> Nil do
  1444.    begin
  1445.       if Temp^.StrPtr <> Nil then
  1446.       begin
  1447.          Move(Temp^.StrPtr^,Len,1);
  1448.          FreeMem(Temp^.StrPtr,succ(Len)); {1.00f}
  1449.       end;
  1450.       if Temp^.PrevNode = nil then
  1451.       begin
  1452.          FreeMem(Temp,sizeof(temp^));
  1453.          Temp := nil;
  1454.       end
  1455.       else
  1456.       begin
  1457.          Temp := Temp^.PrevNode;
  1458.          FreeMem(Temp^.NextNode,sizeof(temp^));
  1459.       end;
  1460.    end;
  1461. end; {desc GroupIOOBJ.Done}
  1462.  
  1463. {||||||||||||||||||||||||||||||||||||||||}
  1464. {                                        }
  1465. {     C h e c k O B J   M E T H O D S    }
  1466. {                                        }
  1467. {||||||||||||||||||||||||||||||||||||||||}
  1468.  
  1469. constructor CheckIOOBJ.Init(X1,Y1,width,depth:byte;Title:string);
  1470. {}
  1471. begin
  1472.    GroupIOOBJ.Init(X1,Y1,width,depth,Title);
  1473.    vOnstr := '[X]';
  1474.    vOffStr := '[ ]';
  1475. end; {CheckIOOBJ.Init}
  1476.  
  1477. function CheckIOOBJ.Select(K:word; X,Y:byte):tAction;
  1478. {}
  1479. var
  1480.   Temp: GroupItemPtr;
  1481.   New: byte;
  1482. begin
  1483.    Display(HiStatus);
  1484.    WriteMessage;
  1485.    New := HotKeyItem(K);
  1486.    if New > 0 then
  1487.    begin
  1488.       if vActiveItem <> New then
  1489.          WriteItem(vActiveItem,false);
  1490.       vActiveItem := New;
  1491.       Temp := NodePtr(vActiveItem);
  1492.       vActiveItem := New;
  1493.       Temp^.Selected := Not Temp^.Selected;
  1494.       WriteItem(vActiveItem,true);
  1495.    end;
  1496.    if K = 513 then
  1497.    begin
  1498.       New := HitItem(X,Y);
  1499.       if New > 0 then
  1500.       begin
  1501.          WriteItem(vActiveItem,false);
  1502.          vActiveItem := New;
  1503.          Temp := NodePtr(vActiveItem);
  1504.          Temp^.Selected := Not Temp^.Selected;
  1505.          WriteItem(vActiveItem,true);
  1506.       end;
  1507.    end;
  1508.    Select := none;
  1509. end; {CheckIOOBJ.Select}
  1510.  
  1511. function CheckIOOBJ.ProcessKey(InKey:word;X,Y:byte):tAction;
  1512. {}
  1513. var
  1514.   Temp: GroupItemPtr;
  1515.   New : byte;
  1516. begin
  1517.    New := HotKeyItem(InKey);
  1518.    if New > 0 then
  1519.    begin
  1520.       if New <> vActiveItem then
  1521.       begin
  1522.           WriteItem(vActiveItem,false);
  1523.           vActiveItem := New;
  1524.       end;
  1525.       Temp := NodePtr(vActiveItem);
  1526.       Temp^.Selected := Not Temp^.Selected;
  1527.       WriteItem(vActiveItem,true);
  1528.    end
  1529.    else
  1530.       case InKey of
  1531.          32:  {space bar}
  1532.          begin
  1533.             Temp := NodePtr(vActiveItem);
  1534.             Temp^.Selected := Not Temp^.Selected;
  1535.             WriteItem(vActiveItem,true);
  1536.          end;
  1537.          513: {mouse enter}
  1538.          begin
  1539.             New := HitItem(X,Y);
  1540.             if New > 0 then
  1541.             begin
  1542.                WriteItem(vActiveItem,false);
  1543.                vActiveItem := New;
  1544.                Temp := NodePtr(vActiveItem);
  1545.                Temp^.Selected := Not Temp^.Selected;
  1546.                WriteItem(vActiveItem,true);
  1547.             end;
  1548.          end;
  1549.          336,592: {down arrow}  {1.00c}
  1550.          begin
  1551.             WriteItem(vActiveItem,false);
  1552.             if vActiveItem < vTotalItems then
  1553.                inc(vActiveItem)
  1554.             else
  1555.                vActiveItem := 1;
  1556.             WriteItem(vActiveItem,true);
  1557.          end;
  1558.          328,584: {up arrow}
  1559.          begin
  1560.             WriteItem(vActiveItem,false);
  1561.             if vActiveItem > 1 then
  1562.                dec(vActiveItem)
  1563.             else
  1564.                vActiveItem := vTotalItems;
  1565.             WriteItem(vActiveItem,true);
  1566.          end;
  1567.       end; {case}
  1568.    if InKey = 13 then
  1569.       ProcessKey := NextField
  1570.    else
  1571.       ProcessKey := None;
  1572. end; {CheckIOOBJ.ProcessKey}
  1573.  
  1574. procedure CheckIOOBJ.SetValue(Item:byte;Selected:boolean);
  1575. {}
  1576. var Temp: GroupItemPtr;
  1577. begin
  1578.    Temp := NodePtr(Item);
  1579.    if Temp <> nil then
  1580.       Temp^.Selected := Selected;
  1581. end; {CheckIOOBJ.SetValue}
  1582.  
  1583. function CheckIOOBJ.GetValue(Item:byte):boolean;
  1584. {}
  1585. var
  1586.   Temp: GroupItemPtr;
  1587. begin
  1588.    Temp := NodePtr(Item);
  1589.    if Temp <> nil then
  1590.       GetValue := Temp^.Selected
  1591.    else
  1592.       GetValue := false;
  1593. end; {CheckIOOBJ.GetValue}
  1594.  
  1595. destructor CheckIOOBJ.Done;
  1596. {}
  1597. begin
  1598.    GroupIOOBJ.Done;
  1599. end; {dest CheckIOOBJ.Done}
  1600.  
  1601. {||||||||||||||||||||||||||||||||||||||||}
  1602. {                                        }
  1603. {     R a d i o O B J   M E T H O D S    }
  1604. {                                        }
  1605. {||||||||||||||||||||||||||||||||||||||||}
  1606.  
  1607. constructor RadioIOOBJ.Init(X1,Y1,width,depth:byte;Title:string);
  1608. {}
  1609. begin
  1610.    GroupIOOBJ.Init(X1,Y1,width,depth,Title);
  1611.    vOnstr :=  '(∙)';
  1612.    vOffStr := '( )';
  1613. end; {RadioIOOBJ.Init}
  1614.  
  1615. procedure RadioIOOBJ.SetValue(Item:byte);
  1616. {}
  1617. var I : Integer;
  1618. begin
  1619.    for I := 1 to vTotalItems do
  1620.       NodePtr(I)^.Selected := (I=Item);
  1621. end; {RadioIOOBJ.SetValue}
  1622.  
  1623. function RadioIOOBJ.ProcessKey(InKey:word;X,Y:byte):tAction;
  1624. {}
  1625. var
  1626.   Temp: GroupItemPtr;
  1627.   I : integer;
  1628.   New: byte;
  1629. begin
  1630.    New := HotKeyItem(InKey);
  1631.    if New <> 0 then
  1632.    begin
  1633.       if New <> vActiveItem then
  1634.       begin
  1635.          vActiveItem := New;
  1636.           Temp := NodePtr(vActiveItem);
  1637.           if not Temp^.Selected then
  1638.           begin
  1639.              SetValue(vActiveItem);
  1640.              for I := 1 to vTotalItems do
  1641.                 WriteItem(I,(I=vActiveItem));
  1642.           end;
  1643.       end;
  1644.    end
  1645.    else
  1646.       case InKey of
  1647.          32:  {space bar}
  1648.          begin
  1649.          (*
  1650.             Temp := NodePtr(vActiveItem);
  1651.             if not Temp^.Selected then
  1652.             begin
  1653.                SetValue(vActiveItem);
  1654.                for I := 1 to vTotalItems do
  1655.                   WriteItem(I,(I=vActiveItem));
  1656.             end;
  1657.            *)
  1658.          end;
  1659.          513: {mouse enter}
  1660.          begin
  1661.             New := HitItem(X,Y);
  1662.             if New > 0 then
  1663.             begin
  1664.                vActiveItem := New;
  1665.                Temp := NodePtr(vActiveItem);
  1666.                if not Temp^.Selected then
  1667.                begin
  1668.                   SetValue(vActiveItem);
  1669.                   for I := 1 to vTotalItems do
  1670.                      WriteItem(I,(I=vActiveItem));
  1671.                end;
  1672.             end;
  1673.          end;
  1674.          336,592: {down arrow} {1.00c}
  1675.          begin
  1676.             SetValue(0);              {1.00i}
  1677.             WriteItem(vActiveItem,false);
  1678.             if vActiveItem < vTotalItems then
  1679.                inc(vActiveItem)
  1680.             else
  1681.                vActiveItem := 1;
  1682.             SetValue(vActiveItem);    {1.00i}
  1683.             WriteItem(vActiveItem,true);
  1684.          end;
  1685.          328,584: {up arrow}
  1686.          begin
  1687.             SetValue(0);              {1.00i}
  1688.             WriteItem(vActiveItem,false);
  1689.             if vActiveItem > 1 then
  1690.                dec(vActiveItem)
  1691.             else
  1692.                vActiveItem := vTotalItems;
  1693.             SetValue(vActiveItem);    {1.00i}
  1694.             WriteItem(vActiveItem,true);
  1695.          end;
  1696.       end; {case}
  1697.    if InKey = 13 then
  1698.       ProcessKey := NextField
  1699.    else
  1700.       ProcessKey := None;
  1701. end; {RadioIOOBJ.ProcessKey}
  1702.  
  1703. function RadioIOOBJ.Select(K:word; X,Y:byte):tAction;
  1704. {}
  1705. var
  1706.   Temp: GroupItemPtr;
  1707.   New: byte;
  1708.   I : integer;
  1709. begin
  1710.    vActiveItem := GetValue;
  1711.    Display(HiStatus);
  1712.    WriteMessage;
  1713.    I := HotKeyItem(K);
  1714.    if I > 0 then
  1715.    begin
  1716.       vActiveItem := I;
  1717.       Temp := NodePtr(vActiveItem);
  1718.       if not Temp^.Selected then
  1719.       begin
  1720.          SetValue(vActiveItem);
  1721.          for I := 1 to vTotalItems do
  1722.             WriteItem(I,(I=vActiveItem));
  1723.       end;
  1724.    end;
  1725.    if K = 513 then
  1726.    begin
  1727.       New := HitItem(X,Y);
  1728.       if New > 0 then
  1729.       begin
  1730.          vActiveItem := New;
  1731.          Temp := NodePtr(vActiveItem);
  1732.          if not Temp^.Selected then
  1733.          begin
  1734.             SetValue(vActiveItem);
  1735.             for I := 1 to vTotalItems do
  1736.                WriteItem(I,(I=vActiveItem));
  1737.          end;
  1738.       end;
  1739.    end;
  1740.    Select := none;
  1741. end; {RadioIOOBJ.Select}
  1742.  
  1743. function RadioIOOBJ.GetValue: byte;
  1744. {}
  1745. var I : integer;
  1746. begin
  1747.    I := 1;
  1748.    While (NodePtr(I)^.Selected = false) and (I < vTotalItems) do
  1749.      inc(I);
  1750.    GetValue := I;
  1751. end; {RadioIOOBJ.GetValue}
  1752.  
  1753. destructor RadioIOOBJ.Done;
  1754. {}
  1755. begin
  1756.    GroupIOOBJ.Done;
  1757. end; {dest RadioIOOBJ.Done}
  1758. {||||||||||||||||||||||||||||||||||||||||||}
  1759. {                                          }
  1760. {     A c t i o n O B J   M E T H O D S    }
  1761. {                                          }
  1762. {||||||||||||||||||||||||||||||||||||||||||}
  1763. constructor FormOBJ.Init;
  1764. {}
  1765. begin
  1766.    vItemStack := nil;
  1767.    vActiveItem := nil;
  1768.    vCharHook := NoCharHook;
  1769.    vLeaveHook := NoLeaveHook;
  1770.    vEnterHook := NoEnterHook;
  1771.    vHelpHook := NoHelpHook;
  1772. end; {cons FormOBJ.Init}
  1773.  
  1774. function FormOBJ.EndNode: pItemNode;
  1775. {returns a pointer to the last item in the last}
  1776. var
  1777.    Temp : pItemNode;
  1778. begin
  1779.    Temp := vItemStack;
  1780.    while (Temp <> nil) and (Temp^.NextNode <> nil) do
  1781.       Temp := Temp^.NextNode;
  1782.    EndNode := Temp;
  1783. end; {FormOBJ.EndNode}
  1784.  
  1785. procedure FormOBJ.AddItem(var NewItem: ItemIOOBJ);
  1786. {}
  1787. var
  1788.    Temp : pItemNode;
  1789. begin
  1790.    if vItemStack = nil then
  1791.    begin
  1792.       GetMem(vItemStack,sizeOf(vItemStack^));
  1793.       vItemStack^.Item := @NewItem;
  1794.       vItemStack^.NextNode := nil;
  1795.       vItemStack^.PrevNode := nil;
  1796.       vActiveItem := vItemStack;
  1797.    end
  1798.    else
  1799.    begin
  1800.       Temp := EndNode;
  1801.       GetMem(Temp^.NextNode,sizeof(Temp^));
  1802.       Temp^.NextNode^.PrevNode := Temp;
  1803.       Temp := Temp^.NextNode;
  1804.       Temp^.Item := @NewItem;
  1805.       Temp^.NextNode := nil;
  1806.    end;
  1807. end; {FormOBJ.AddItem}
  1808.  
  1809. procedure FormOBJ.SetCharHook(Func:CharFunc);
  1810. {}
  1811. begin
  1812.    vCharHook := Func;
  1813. end; {FormOBJ.SetCharHook}
  1814.  
  1815. procedure FormOBJ.SetLeaveHook(Func:LeaveFieldFunc);
  1816. {}
  1817. begin
  1818.    vLeaveHook := Func;
  1819. end; {FormOBJ.SetLeaveHook}
  1820.  
  1821. procedure FormOBJ.SetEnterHook(Func:EnterFieldFunc);
  1822. {}
  1823. begin
  1824.    vEnterHook := Func;
  1825. end; {FormOBJ.SetEnterHook}
  1826.  
  1827. procedure FormOBJ.SetHelpHook(Proc:HelpProc);
  1828. {}
  1829. begin
  1830.    vHelpHook := Proc;
  1831. end; {FormOBJ.SetHelpHook}
  1832.  
  1833. procedure FormOBJ.DisplayItems;
  1834. {}
  1835. var
  1836.    Temp: pItemNode;
  1837. begin
  1838.    Temp := vItemStack;
  1839.    while Temp <> Nil do
  1840.    begin
  1841.       if Temp^.Item^.Active then
  1842.       begin
  1843.          if Temp = vActiveItem then
  1844.          begin
  1845.             Temp^.Item^.Display(HiStatus);
  1846.             Temp^.Item^.WriteLabel(HiStatus);
  1847.          end
  1848.          else
  1849.          begin
  1850.             Temp^.Item^.Display(Norm);
  1851.             Temp^.Item^.WriteLabel(Norm);
  1852.          end;
  1853.       end
  1854.       else
  1855.       begin
  1856.          Temp^.Item^.Display(Off);
  1857.          Temp^.Item^.WriteLabel(Off);
  1858.       end;
  1859.       Temp := Temp^.NextNode;
  1860.    end;
  1861. end; {FormOBJ.DisplayItems}
  1862.  
  1863. function FormOBJ.IDItemPtr(ID:word):pItemNode;
  1864. {returns a pointer to the item which has the specified ID --
  1865.  if no item is found the function returns nil}
  1866. var
  1867.   Temp: pItemNode;
  1868.   proceed: boolean;
  1869. begin
  1870.    Temp := vItemStack;
  1871.    Proceed := true;
  1872.    while (Temp <> Nil) and Proceed do
  1873.    begin
  1874.       if Temp^.Item^.GetID = ID then
  1875.          Proceed := false
  1876.       else
  1877.          Temp := Temp^.NextNode;
  1878.    end;
  1879.    IDItemPtr := Temp;
  1880. end; {FormOBJ.IDItemPtr}
  1881.  
  1882. procedure FormOBJ.SetActiveItem(ID:word);
  1883. {}
  1884. begin
  1885.    vActiveItem := IDItemPtr(ID);
  1886.    if vActiveItem = nil then
  1887.       vActiveItem := vItemStack;
  1888. end; {FormOBJ.SetActiveItem}
  1889.  
  1890. function FormOBJ.HotkeyItemPtr(Hotkey:word):pItemNode;
  1891. {returns a pointer to the item which can be selected with the hotkey --
  1892.  if no item is found the function returns nil}
  1893. var
  1894.   Temp: pItemNode;
  1895.   proceed: boolean;
  1896. begin
  1897.    if Hotkey = 0 then    {1.10b}
  1898.    begin
  1899.       HotkeyItemPtr := nil;
  1900.       exit;
  1901.    end;
  1902.    if AlphabetTOT^.IsLower(HotKey) then
  1903.       HotKey := ord(AlphabetTOT^.GetUpcase(chr(HotKey)));
  1904.    if vActiveItem^.Item^.IsHotKey(Hotkey) then
  1905.       HotKeyItemPtr := vActiveItem
  1906.    else
  1907.    begin
  1908.       Proceed := true;
  1909.       Temp := vItemStack;
  1910.       while (Temp <> Nil) and Proceed do
  1911.       begin
  1912.          if Temp^.Item^.IsHotKey(Hotkey) then
  1913.             Proceed := false
  1914.          else
  1915.             Temp := Temp^.NextNode;
  1916.       end;
  1917.       HotkeyItemPtr := Temp;
  1918.    end;
  1919. end; {FormOBJ.HotkeyItemPtr}
  1920.  
  1921. function FormOBJ.HotSpotItemPtr(X,Y:byte):pItemNode;
  1922. {returns a pointer to the item which can has been clicked on with the mouse --
  1923.  if no item is found the function returns nil}
  1924. var
  1925.   Temp: pItemNode;
  1926.   proceed: boolean;
  1927. begin
  1928.    if vActiveItem^.Item^.OnTarget(X,Y) then   {1.00b}
  1929.       Temp := vActiveItem
  1930.    else
  1931.    begin
  1932.       Temp := vItemStack;
  1933.       Proceed := true;
  1934.       while (Temp <> Nil) and Proceed do
  1935.       begin
  1936.          if Temp^.Item^.OnTarget(X,Y) then
  1937.             Proceed := false
  1938.          else
  1939.             Temp := Temp^.NextNode;
  1940.       end;
  1941.    end;
  1942.    HotSpotItemPtr := Temp;
  1943. end; {FormOBJ.HotSpotItemPtr}
  1944.  
  1945. procedure FormOBJ.BroadcastSignal(TheSig:tSignal; SignalSource: pItemNode);
  1946. {recursive signal passer - an item which is handling a signal may raise
  1947.  an additional signal}
  1948. var
  1949.   ItemPtr: pItemNode;
  1950.   NewSig: tSignal;
  1951. begin
  1952.    ItemPtr := SignalSource;
  1953.    repeat
  1954.       {move on to next node}
  1955.       if ItemPtr^.NextNode <> nil then
  1956.          ItemPtr := ItemPtr^.NextNode
  1957.       else
  1958.          ItemPtr := vItemStack;
  1959.       NewSig.ID := 0;  {do nothing}
  1960.       ItemPtr^.Item^.HandleSignal(TheSig,NewSig);
  1961.       if NewSig.ID <> 0 then
  1962.          BroadcastSignal(NewSig,ItemPtr);
  1963.       if TheSig.ID = 0 then
  1964.       begin
  1965.          SignalSource^.Item^.ShutdownSignal(TheSig);
  1966.          if TheSIG.ID = 0 then
  1967.             exit
  1968.          else
  1969.             BroadcastSignal(TheSig,SignalSource);
  1970.       end;
  1971.    until ItemPtr = SignalSource;
  1972.    SignalSource^.Item^.ShutdownSignal(TheSig);
  1973. end; {FormOBJ.BroadcastSignal}
  1974.  
  1975. procedure FormOBJ.HelpTask(ID:word);
  1976. {}
  1977. begin
  1978.    vHelpHook(ID);
  1979. end; {FormOBJ.HelpTask}
  1980.  
  1981. function FormOBJ.CharTask(var K:word;var X,Y:byte;var FieldID:word):tAction;
  1982. {}
  1983. begin
  1984.    CharTask := vCharHook(K,X,Y,FieldID);
  1985. end; {FormOBJ.CharTask}
  1986.  
  1987. function FormOBJ.EnterTask(var NewID:word; OldID:word): tAction;
  1988. {}
  1989. begin
  1990.    EnterTask := vEnterHook(NewID,OldID);
  1991. end; {FormOBJ.EnterTask}
  1992.  
  1993. function FormOBJ.LeaveTask(var FieldID:word): tAction;
  1994. {}
  1995. begin
  1996.    LeaveTask := vLeaveHook(FieldID);
  1997. end; {FormOBJ.LeaveTask}
  1998.  
  1999. procedure FormOBJ.AdjustKey(var Key:word;var X,Y: byte);
  2000. {abstract}
  2001. begin end;
  2002.  
  2003. function FormOBJ.Go: tAction;
  2004. {}
  2005. var
  2006.    HookAction,
  2007.    Task : tAction;
  2008.    NewItemPtr: pItemNode;
  2009.    LastActiveItemID,ID,K,W: word;
  2010.    X,Y:byte;
  2011.    Mvisible:boolean;
  2012.  
  2013.    procedure ProcessTask;
  2014.    {}
  2015.    var TheSig: tSignal;
  2016.    begin
  2017.       case Task of
  2018.          NextField: begin
  2019.                        NewItemPtr := vActiveItem;
  2020.                        repeat
  2021.                           if NewItemPtr^.NextNode <> Nil then
  2022.                              NewItemPtr := NewItemPtr^.NextNode
  2023.                           else
  2024.                              NewItemPtr := vItemStack;
  2025.                         until NewItemPtr^.Item^.Active;
  2026.                     end;
  2027.          PrevField: begin
  2028.                        NewItemPtr := vActiveItem;
  2029.                        repeat
  2030.                           if NewItemPtr^.PrevNode <> Nil then
  2031.                              NewItemPtr := NewItemPtr^.PrevNode
  2032.                           else
  2033.                              NewItemPtr := EndNode;
  2034.                         until NewItemPtr^.Item^.Active;
  2035.                     end;
  2036.          Refresh: DisplayItems;
  2037.          Signal: begin
  2038.                     vActiveItem^.Item^.RaiseSignal(TheSig);
  2039.                     if TheSig.ID <> 0 then
  2040.                        BroadcastSignal(TheSig,vActiveItem);
  2041.                  end;
  2042.          Help: begin
  2043.                   HelpTask(LastActiveItemID);
  2044.                   if LastActiveItemID <> 0 then
  2045.                   begin
  2046.                      if LastActiveItemID <> HelpID then
  2047.                         if vActiveItem^.Item^.Suspend then
  2048.                            vActiveItem := IDItemPtr(LastActiveItemID);
  2049.                   end;
  2050.                   Task := vActiveItem^.Item^.Select(0,X,Y);
  2051.                end;
  2052.       end; {case}
  2053.    end; {ProcessTask}
  2054.  
  2055.    procedure ProcessChar;
  2056.    {}
  2057.    var Bypassing, Ignore : boolean;
  2058.    begin
  2059.       Key.GetInput;
  2060.       K := Key.LastKey;
  2061.       X := Key.LastX;
  2062.       Y := key.LastY;
  2063.       Ignore := false;
  2064.       AdjustKey(K,X,Y);
  2065.       if K = 600 then
  2066.          HookAction := Escaped
  2067.       else
  2068.       begin
  2069.          ID := vActiveItem^.Item^.GetID;
  2070.          HookAction := CharTask(K,X,Y,ID);
  2071.       end;
  2072.       Case HookAction of
  2073.          Escaped,
  2074.          Finished,
  2075.          Stop1..Stop9 : begin
  2076.                           Task := HookAction;
  2077.                           exit;
  2078.                         end;
  2079.          Refresh: DisplayItems;
  2080.       end; {case}
  2081.       if ID <> vActiveItem^.Item^.GetID then {hook changed the active field}
  2082.          NewItemPtr := IDItemPtr(ID)
  2083.       else
  2084.          NewItemPtr := HotKeyItemPtr(K);
  2085.       if NewItemPtr = nil then {no hotkey pressed}
  2086.       begin
  2087.          if (K = 513) or (K=523) then  {mouse Pressed}
  2088.          begin
  2089.             NewItemPtr := HotSpotItemPtr(X,Y);
  2090.             if NewItemPtr = vActiveItem then
  2091.             begin
  2092.                Task := vActiveItem^.Item^.ProcessKey(K,X,Y);
  2093.                ProcessTask;
  2094.                Ignore := true;
  2095.             end;
  2096.             if NewItemPtr = nil then
  2097.                Ignore := true
  2098.             else
  2099.                delay(175);         {avoids Mouse multi-select effect} {1.00m}
  2100.          end
  2101.          else
  2102.          begin
  2103.             Task := vActiveItem^.Item^.ProcessKey(K,X,Y);
  2104.             ProcessTask;
  2105.          end;
  2106.       end;
  2107.       if (NewItemPtr <> Nil) and (Ignore = false) then
  2108.       begin
  2109.          ByPassing := false;
  2110.          repeat
  2111.             if EscapingForm then
  2112.             begin
  2113.                Task := Escaped;
  2114.             end
  2115.             else if FormHelpCalled then
  2116.             begin
  2117.                HelpTask(vActiveItem^.Item^.GetID);
  2118.                Task := none;
  2119.                FormHelpCalled := false;
  2120.             end
  2121.             else
  2122.             begin
  2123.                if Bypassing or vActiveItem^.Item^.Suspend then
  2124.                begin
  2125.                   {Leave Hook}
  2126.                   if (vActiveItem^.Item^.Active)
  2127.                   and (Bypassing = false) then {don't Hook if Bypassing}
  2128.                   begin
  2129.                      ID := vActiveItem^.Item^.GetID;
  2130.                      HookAction := LeaveTask(ID);
  2131.                      Case HookAction of
  2132.                         Escaped,
  2133.                         Finished,
  2134.                         Stop1..Stop9 : begin
  2135.                              Task := HookAction;
  2136.                              exit;
  2137.                            end;
  2138.                         Refresh: begin                           {1.00n}
  2139.                              DisplayItems;
  2140.                              vActiveItem^.Item^.Display(Norm);
  2141.                              vActiveItem^.Item^.WriteLabel(Norm); {1.10a -- thanks Peter!}
  2142.                            end;
  2143.                      end; {case}
  2144.                      if ID = StayPut then {1.00h}
  2145.                      begin
  2146.                         Task := None;
  2147.                         vActiveItem^.Item^.Display(HiStatus);         {1.00o}
  2148.                         exit;
  2149.                      end else if ID <> vActiveItem^.Item^.GetID then {hook changed the active field}
  2150.                         NewItemPtr := IDItemPtr(ID);
  2151.                   end;
  2152.                   {Change active fields}
  2153.                   if NewItemPtr^.Item^.Active then
  2154.                   begin
  2155.                      vActiveItem := NewItemPtr;
  2156.                      {Enter Hook}
  2157.                      ID := vActiveItem^.Item^.GetID;
  2158.                      HookAction := EnterTask(ID,LastActiveItemID);
  2159.                      Case HookAction of
  2160.                         Escaped,
  2161.                         Finished,
  2162.                         Stop1..Stop9: begin
  2163.                                          Task := HookAction;
  2164.                                          exit;
  2165.                                       end;
  2166.                         Refresh: DisplayItems;
  2167.                      end; {case}
  2168.                      if ID <> vActiveItem^.Item^.GetID then {hook changed the active field}
  2169.                      begin
  2170.                         ByPassing := true;
  2171.                         NewItemPtr := IDItemPtr(ID);
  2172.                         Task := None;
  2173.                      end
  2174.                      else
  2175.                      begin
  2176.                         ByPassing := false;
  2177.                         W := vActiveItem^.Item^.GetID;
  2178.                         if ((W <> 0) and (W <> HelpID))
  2179.                         or ((W = HelpID) and ((K <> 513) and (K <> vActiveItem^.Item^.GetHotKey))) then
  2180.                            LastActiveItemID := W;
  2181.                         Task := vActiveItem^.Item^.Select(K,X,Y);
  2182.                      end;
  2183.                   end
  2184.                   else
  2185.                   begin                {1.00d}
  2186.                      {No Enter Hook for inactive tasks}
  2187.                      Task := NewItemPtr^.Item^.Select(K,X,Y);
  2188.                      if not (Task in [Finished,Escaped,Stop1..Stop9]) then {1.00g}
  2189.                         ByPassing := true;
  2190.                   end;
  2191.                   ProcessTask;
  2192.                end
  2193.                else    {suspension failed due to validation error}
  2194.                   Task := None; {don't leave field}
  2195.             end;
  2196.          until (Bypassing = false) and ((Task in [NextField,PrevField]) = false);
  2197.       end;
  2198.    end; {ProcessChar}
  2199.  
  2200. begin
  2201.    EscapingForm := false;
  2202.    FormHelpCalled := false;
  2203.    DisplayItems;
  2204.    Mvisible := Mouse.Visible;
  2205.    if not MVisible then
  2206.       Mouse.Show;
  2207.    {No Enter Hook at initial start-up}
  2208.    if not vActiveItem^.Item^.Visible then
  2209.    begin
  2210.       vActiveItem := vItemStack;
  2211.       while (vActiveItem <> Nil) and (vActiveItem^.Item^.Visible = false) do
  2212.          vActiveItem := vActiveItem^.NextNode;
  2213.    end;
  2214.    if vActiveItem = nil then {no fields to edit}
  2215.    begin
  2216.       Go := None;  {1.00a}
  2217.    end
  2218.    else
  2219.    begin
  2220.       Task := vActiveItem^.Item^.Select(0,0,0);
  2221.       LastActiveItemID := vActiveItem^.Item^.GetID;
  2222.       Task := None;
  2223.       Repeat
  2224.          ProcessChar;
  2225.       Until (Task in [Finished,Escaped,Stop1..Stop9]);
  2226.       Mouse.WaitForRelease;     {1.10a}
  2227.       if Task <> Escaped then
  2228.         if vActiveItem^.Item^.Suspend then;
  2229.       Go := Task;
  2230.    end;
  2231.    if not MVisible then
  2232.       Mouse.Hide;
  2233.    EscapingForm := false;
  2234.    FormHelpCalled := false;
  2235. end; {FormOBJ.Go}
  2236.  
  2237. function FormOBJ.StopID:word;
  2238. {1.00j}
  2239. begin
  2240.    If vActiveItem = nil then
  2241.       StopID := 0
  2242.    else
  2243.       StopID := vActiveItem^.Item^.GetID;
  2244. end; {FormOBJ.StopID}
  2245.  
  2246. destructor FormOBJ.Done;
  2247. {frees all allocated memory for the linked list}
  2248. var
  2249.   Temp1, Temp2: pItemNode;
  2250. begin
  2251.    if vItemStack <> nil then
  2252.    begin
  2253.       Temp1 := vItemStack;
  2254.       Temp2 := Temp1^.NextNode;
  2255.       while Temp2 <> nil do
  2256.       begin
  2257.           Freemem(Temp1,sizeof(Temp1^));
  2258.           Temp1 := Temp2;
  2259.           Temp2 := Temp1^.NextNode;
  2260.       end;
  2261.       Freemem(Temp1,sizeof(Temp1^));
  2262.    end;
  2263. end; {destructor FormOBJ.Done}
  2264. {||||||||||||||||||||||||||||||||||||||||||||||||}
  2265. {                                                }
  2266. {     W i n A c t i o n O B J   M E T H O D S    }
  2267. {                                                }
  2268. {||||||||||||||||||||||||||||||||||||||||||||||||}
  2269.  
  2270. constructor WinFormOBJ.Init;
  2271. {}
  2272. begin
  2273.    New(vWinPtr,Init);
  2274.    FormOBJ.Init;
  2275. end; {WinFormOBJ.Init}
  2276.  
  2277. procedure WinFormOBJ.AdjustKey(var Key:word;var X,Y: byte);
  2278. {}
  2279. var WX,WY: byte;
  2280.     TempX,TempY: integer;
  2281. begin
  2282.    vWinPtr^.WinKey(Key,X,Y);
  2283.    TempX := X;
  2284.    TempY := Y;
  2285.    WX := vWinPtr^.GetX;
  2286.    WY := vWinPtr^.GetY;
  2287.    if (Key > 600) or (TempX < WX) or (TempY < WY) then
  2288.    begin
  2289.       TempX := 0;
  2290.       TempY := 0;
  2291.    end
  2292.    else
  2293.    begin
  2294.        Case vWinPtr^.GetStyle of
  2295.        0: begin
  2296.           dec(TempX,pred(WX));
  2297.           dec(TempY,pred(WY));
  2298.        end;
  2299.        6: begin
  2300.           dec(TempX,pred(WX));
  2301.           dec(TempY,WY + 2);
  2302.        end;
  2303.        else begin
  2304.           dec(TempX,WX);
  2305.           dec(TempY,WY);
  2306.        end;
  2307.        end; {case}
  2308.    end;
  2309.    if TempX > 0 then
  2310.       X := TempX
  2311.    else
  2312.       X := 0;
  2313.    if TempY > 0 then
  2314.       Y := TempY
  2315.    else
  2316.       Y := 0;
  2317. end; {WinFormOBJ.AdjustKey}
  2318.  
  2319. function WinFormOBJ.Win: MoveWinPtr;
  2320. {}
  2321. begin
  2322.    Win := vWinPtr;
  2323. end; {WinFormOBJ.Win}
  2324.  
  2325. procedure WinFormOBJ.Draw;
  2326. {}
  2327. begin
  2328.    vWinPtr^.Draw;
  2329. end; {WinFormOBJ.DisplayItems}
  2330.  
  2331. destructor WinFormOBJ.Done;
  2332. {}
  2333. begin
  2334.    Dispose(vWinPtr,Done);
  2335.    FormOBJ.Done;
  2336. end; {WinFormOBJ.Done}
  2337.  
  2338. {|||||||||||||||||||||||||||||||||||||||||||||||}
  2339. {                                               }
  2340. {     U N I T   I N I T I A L I Z A T I O N     }
  2341. {                                               }
  2342. {|||||||||||||||||||||||||||||||||||||||||||||||}
  2343. procedure IO1Init;
  2344. {initilizes objects and global variables}
  2345. begin
  2346.    new(IOTOT,Init);
  2347. end; {IO1Init}
  2348.  
  2349. {end of unit - add initialization routines below}
  2350. {$IFNDEF OVERLAY}
  2351. begin
  2352.    IO1Init;
  2353. {$ENDIF}
  2354. end.
  2355.